#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dominion.h"

void testing(struct gameState *game);

int main(int argc, char *argv[]){
	struct gameState *game = malloc(sizeof(struct gameState));
	testing(game);
	free(game);
	return 0;
}

void testing(struct gameState *game){
	struct gameState *after = malloc(sizeof(struct gameState));

	int player = 0;
	
	int i;
	for(i = 0; i < 4; i ++){
		player = (rand() % MAX_PLAYERS) + 1;
		int j;
		for(j = 0; j < MAX_PLAYERS; j++){
			game->deckCount[j] = (rand() % MAX_PLAYERS);//Check deckCount on gamestate struct
			game->discardCount[j] = (rand() % MAX_PLAYERS);//Check discardCount on gamestate struct
			game->handCount[j] = (rand() % MAX_PLAYERS);//Check handCount on gamestate struct
			
			int p;
			for(p = 0; p < MAX_DECK; p++){
				game->deck[j][p] = (rand() % MAX_DECK);
				game->discard[j][p] = (rand() % MAX_DECK);
			}
			int l;
			for(l = 0; l < MAX_HAND; l++){
				game->hand[j][l] = (rand() % MAX_HAND);
			}
		}

		memcpy(after, game, sizeof(struct gameState));


		drawCard(player, game);

		printf("Player = %d\n", player);
		printf("Deck Count: %d\n", game->deckCount[i]);
		printf("Discard Count: %d\n", game->discardCount[i]);
		printf("Hand Count: %d\n", game->handCount[i]);

		memcmp(game, after, sizeof(struct gameState));

		if(memcmp(game, after, sizeof(struct gameState)) == 0){
			printf("Unit Test 2 Failed no change in gamestate.\n");
		}
		else{
			printf("Unit Test 2 Passed gamestate adjusted.\n");
		}
	}
	free(after);
	return;
}